#!/usr/bin/env python
# coding=utf-8

import sys
import os
reload(sys)
sys.setdefaultencoding("utf8")
path = sys.argv[1]

for root, dirs, files in os.walk(path):
	print("获取文件名---------")
#print(files) #当前路径下所有非目录子文件 
for f in files:
	print(f)
	f_pcm = path+"/"+f.replace(".silk", ".pcm")
	f_mp3 = path+"/"+f.replace(".silk", ".mp3")
# silk -> pcm
	os.system("./decoder " + path+"/"+f + " " + f_pcm)
# pcm -> mp3
	os.system("ffmpeg -y -f s16be -ac 1 -ar 24000 -acodec pcm_s16le -i " + f_pcm + " " + f_mp3)
